Skip to content

Backfill shared assets the sync path does not carry (bibliography + Phillips data file)#203

Merged
mmcky merged 1 commit into
mainfrom
fix/sync-shared-assets-phillips
Jul 24, 2026
Merged

Backfill shared assets the sync path does not carry (bibliography + Phillips data file)#203
mmcky merged 1 commit into
mainfrom
fix/sync-shared-assets-phillips

Conversation

@mmcky

@mmcky mmcky commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Backfills the shared assets that the translation sync path does not carry across, so that #202 can build and the next sync that adds a citation does not fail the same way.

Why this edition's bibliography drifts

The sync workflow watches lectures/**/*.md and lectures/_toc.yml. Assets referenced by lectures — the shared bibliography, _static/lecture_specific/** data files, _admonition/* includes — are outside that set and have never crossed. The drift is invisible until a newly-synced lecture happens to cite something missing, at which point the strict build (-n -W) fails. Tracked upstream as QuantEcon/action-translation#117.

As of today this bibliography was 70 entries behind lecture-python.myst (405 against 472).

What #202 exposed

The Phillips Curve series cites 57 keys that were absent here, and lectures/phillips_drifts_volatilities.md loads a data file that raises FileNotFoundError by design when it cannot be found:

    relative = Path('_static/lecture_specific/phillips_drifts_volatilities')
    ...
    raise FileNotFoundError(f'NEWQDATA.csv was not found; searched {searched}')

That cell is the one that produces fig-csdv-inflation-persistence, so its absence also produced an undefined label warning for a {numref} 1300 lines further down — both the figure definition and the reference are present and correctly translated, and the label was undefined only because the data never arrived.

What this PR does

Bibliography entries added 70 (all missing upstream entries, not only the 57 this PR needs)
Data files added lectures/_static/lecture_specific/phillips_drifts_volatilities/NEWQDATA.csv
Entries removed or modified none

Backfilling all 70 rather than the 57 required is deliberate: the remaining 13 are the next occurrence of this failure waiting to happen.

Verification

  • All 57 keys the failing build reported now resolve against the merged file
  • Key count 405 → 475, no duplicate keys, brace-balanced
  • Additive only — the three target-only keys (GilboaSchmeidler:1989, Whittle_1981, Whittle_1990, cited by robust_permanent_income.md and theil_2.md) are untouched

Note that this fixes one of the two reasons #202 is red. The other is its _toc.yml entry for a lecture the sync run failed to translate — QuantEcon/action-translation#156.

🤖 Generated with Claude Code

The translation sync workflow watches lectures/**/*.md and lectures/_toc.yml,
so shared assets referenced *by* lectures never cross from the English source.
This edition's bibliography had drifted 70 entries behind upstream, and the
gap only surfaces when a newly-synced lecture happens to cite a missing key.

PR #202 (the Phillips Curve series) cites 57 keys that were absent here, and
lectures/phillips_drifts_volatilities.md loads a data file that raises
FileNotFoundError by design when it cannot be found — which then cascades into
an undefined-label warning for the figure that cell would have produced.

Backfills all 70 missing upstream entries rather than only the 57 this PR
needs, so the next sync that adds a citation does not fail the same way, and
adds the missing NEWQDATA.csv asset. Additive only: the three target-only keys
cited by robust_permanent_income.md and theil_2.md are preserved.

Refs QuantEcon/action-translation#117
Copilot AI review requested due to automatic review settings July 23, 2026 22:50
@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

Name Link
🔨 Latest commit d232584
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a629abe5a17d000085b1a77
😎 Deploy Preview https://deploy-preview-203--astonishing-narwhal-a8fc64.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR backfills shared, non-lecture assets (bibliography entries and a lecture-specific data file) that the automated translation sync workflow does not copy into lecture-python.zh-cn, preventing strict documentation builds from failing when newly-synced lectures introduce new citations or data dependencies.

Changes:

  • Appends a new synced block of BibTeX entries to lectures/_static/quant-econ.bib to close the drift with upstream.
  • Adds lectures/_static/lecture_specific/phillips_drifts_volatilities/NEWQDATA.csv to satisfy the Phillips Curve lecture’s data load path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lectures/_static/quant-econ.bib Adds a backfilled set of upstream BibTeX entries for citation resolution in strict builds.
lectures/_static/lecture_specific/phillips_drifts_volatilities/NEWQDATA.csv Adds the missing dataset required by the Phillips drifts/volatilities lecture code cells.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 23, 2026 23:23 Inactive
@mmcky
mmcky merged commit 0e763db into main Jul 24, 2026
8 of 9 checks passed
@mmcky
mmcky deleted the fix/sync-shared-assets-phillips branch July 24, 2026 00:32
mmcky added a commit that referenced this pull request Jul 24, 2026
…#204)

pybtex refuses to parse a bibliography containing a repeated key, and this file
has carried three of them — GilboaSchmeidler:1989, Whittle_1981 and Whittle_1990
each appear twice, once indented in the main body and once unindented near the
end. The two copies of each are byte-identical apart from leading whitespace.

The effect is total rather than local: `parse_file` raises
`BibliographyDataError: repeated bibliography entry` and no bibliography is
built, so *every* {cite} in the edition fails to resolve. That is what the
"could not find bibtex key" warnings on #202 actually are — the keys are present
in the file, but nothing ever parsed it. The 70 entries backfilled in #203 were
correct and could never have taken effect while this stood.

Predates #203: the same three duplicates and the same parse error are present at
693aa63, before that PR.

Verified: pybtex now parses 480 entries, and all 61 keys the #202 build reported
missing resolve, as do the three formerly-duplicated ones.

Removes the later copy of each; the earlier copy in the main body is kept.
mmcky added a commit to QuantEcon/action-translation that referenced this pull request Jul 27, 2026
* Backfill bibliography entries for citations a sync introduces

sync and forward translate {cite} roles, but the bibliography those keys
resolve against is a shared file that never crossed the boundary:
sync-orchestrator filters changed files to .endsWith('.md'), and the
engine had zero occurrences of .bib or bibtex anywhere in src/. It had no
bibliography concept at all — init only ever got one as a side effect of
copying every non-markdown file wholesale.

Under a strict build (-n -W) Sphinx promotes "could not find bibtex key"
to a hard failure, so the target stopped building on a file nobody
edited. Three manual repairs so far: four lectures in one resync wave,
then 70 keys (see QuantEcon/lecture-python.zh-cn#203), then 21 more on
2026-07-27.

The trigger is demand-driven, not diff-driven. lecture-python-intro's
msy_fishery.md cites five keys lecture-intro.zh-cn lacks and no source PR
touches the bib — the target simply has not translated that lecture yet.
A "did the source diff touch the .bib" design misses that class entirely.

Safety model: a key that already resolves in the target is never a
candidate, and appends never rewrite existing bytes, so an edition that
has localised an entry cannot have it clobbered. The observation that the
estate's bibs are currently strict subsets of their sources is not relied
on anywhere. Ambiguity is reported rather than guessed — a key declared
twice in the source, or differing from an existing target key only in
case, fails the run. Keys already dangling before the run are warnings,
not errors: the run did not introduce them.

Two measured details drive the implementation, both pinned by tests:

- The entry parser tolerates leading whitespace. Eight of the 501 entries
  in quant-econ.bib are indented; an ^@-anchored parser finds 493 and
  would re-append those eight, producing exactly the duplicate-key -W
  failure this prevents.
- The citation walker is stack-based and selectively transparent,
  descending into {note}/{exercise}/{warning}/{prf:*} while staying
  opaque inside code cells. 71 of 922 citations in lecture-python.myst
  (7.7%) live inside admonitions; a flat skip-all-fences walker misses
  every one.

New `bibliography` input selects backfill (default), lint or off. An
unrecognised value fails the run — a disabled guard looks exactly like a
passing one.

Refs #117

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Fail closed on bibliography fetch errors, and correct a stale metric

Both from Copilot's review of #226.

1. `fetchBibliographies` swallowed every error from reading the target's
   `_config.yml` as "this edition has no bibliography". A rate limit, a
   5xx or a permissions failure therefore disabled the guard silently and
   the run went green having skipped the check — the exact failure shape
   this module exists to remove, and a contradiction of the fail-closed
   discipline applied to the bibliography read one function lower. Only a
   genuine 404 now means "not applicable"; every other status fails the
   run with the status in the message.

   The same bare catch guarded the source-side read. Copilot flagged one
   instance; the principle covers both. A transient failure there would
   have surfaced as a misleading "resolves in neither bibliography" error
   attributed to the wrong cause.

2. The module header quoted 45 of 872 citations (5.2%) inside non-code
   containers, from the design note. The figure measured against the
   current corpus is 71 of 922 (7.7%), which is what the tests and the PR
   body state. Corrected, anchored to the commit it was measured at, and
   marked indicative — nothing depends on its exact value; it is quoted
   to justify why the walker is stack-based rather than flat.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants